﻿using System;

namespace MyFloridaHouse.libSvOpenDistricts.ViewModel
{
    public partial class ViewModelBase
    {
        #region properties
        private bool _isDistrictLayerVisible = true;
        public bool isDistrictLayerVisible
        {
            get { return _isDistrictLayerVisible; }
            set
            {
                if (_isDistrictLayerVisible != value)
                {
                    _isDistrictLayerVisible = value;
                    districtMapLayer.showLayer = isDistrictLayerVisible;
                    NotifyPropertyChanged("isDistrictLayerVisible");
                    NotifyPropertyChanged("showDistrictLayerCommandLabel");
                }
            }
        }
        public string showDistrictLayerCommandLabel
        {
            get
            {
                if (isDistrictLayerVisible)
                {
                    return "Hide Districts";
                }
                else
                {
                    return "Show Districts";
                }
            }
        }
        #endregion        #endregion

        #region Commands
        private bool CmdToggleShowDistrictLayerCanExecute(object parameter)
        {
            return true;
        }

        private void CmdToggleShowDistrictLayerExecute(object parameter)
        {
            if (isDistrictLayerVisible)
            {
                isDistrictLayerVisible = false;
            }
            else
            {
                isDistrictLayerVisible = true;
            }

        }
        #endregion


    }
}
